<!-- 搜索跳转中转页面，根据文章的类别(category_id)跳转至对应类别的详情显示页 -->
<template>
	<view>
		<!-- 加载中图标，占位 -->
		<u-loading-icon></u-loading-icon>
	</view>
</template>

<script>
	// #ifdef APP
	import UniShare from '@/uni_modules/uni-share/js_sdk/uni-share.js';
	import uniNavBar from '@/uni_modules/uni-nav-bar/components/uni-nav-bar/uni-nav-bar.vue';
	const uniShare = new UniShare();
	// #endif
	export default {
		data() {
			return { //跳转到页面时传入的参数
				inParam: {},
			}
		},
		async onLoad(event) {
			//this.inParam = event; //浅拷贝，onLoad()结束后event被销毁
			//this.inParam = JSON.parse(JSON.stringify(event));
			let db = uniCloud.databaseForJQL();
			let catName = await db.collection('NeuHelper-PostCategories')
				.where(`"_id" == '${event.catId}'`).field('name').get();
			//console.log(catName)
			catName = catName.data[0].name;
				
			if (catName == "校园资讯") { //如果接受的是校园资讯帖子
				uni.redirectTo({
					url: `/subpages/campusDetail/campusDetail?id=${event.postId}`,
					animationType: 'auto'
				})
			} else {
				uni.redirectTo({
					url: `/subpages/InquiryInfo/InquiryInfo?id=${event.postId}`,
					animationType: 'auto'
				})
			}
		}
	}
</script>

<style scoped>
</style>
